﻿using System.Windows.Forms;
using pub.CmdUI.Cmd;
using pub.CmdUI.UI.Control;

namespace todo.Cmd.View
{
    public class ShowProgressCmd : DefaultCmd, ICmdState
    {

        public ShowProgressCmd()
        {
            Shortcut = new CmdShortcut(Keys.Control | Keys.P);
        }

        bool? ICmdState.Checked
        {
            get { return App.Settings.ProgressVisible; }
        }

        public override void Execute(IControlUI controlUi)
        {
            var progressVisible = !App.Settings.ProgressVisible;
            App.MainForm.Www.Document.InvokeScript("setColumnVisible",
                    new object[] {"progress", progressVisible});
            App.Settings.ProgressVisible = progressVisible;
        }
    }
}